cmake_minimum_required(VERSION 3.16)
project(lcir)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_BUILD_TYPE "Debug")

set(CMAKE_CXX_FLAGS "-Wall -Werror -Wno-unused-variable -Wno-unused-function  -Wno-unused-local-typedef -Wno-unused-but-set-variable")

# set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Werror")

# set(CMAKE_CXX_COMPILER "clang++")
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)

find_program(CCACHE_FOUND ccache)

if(CCACHE_FOUND)
	set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ccache)
	set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK ccache)
endif(CCACHE_FOUND)

file(GLOB_RECURSE src CONFIGURE_DEPENDS "./lib/*.cpp")

add_library(lcir ${src})
target_include_directories(lcir PUBLIC "./include")


# lcir example
if(ENABLE_EXAMPLE)
	file(GLOB_RECURSE example_src CONFIGURE_DEPENDS "./example/*.cpp")
	add_executable(example ${example_src})
	target_link_libraries(example lcir)
	target_include_directories(example PRIVATE "./include")
endif()

if(ENABLE_TEST)
  add_subdirectory(third_party/googletest)
	add_subdirectory(test)
endif()